Return to doc.sitecore.com

Migration of XSLT templates from Sitecore V4

You can easily migrate your working XSLT renderings from Sitecore V4 to Sitecore V5. The matter is that XslHelper and MainUtil classes implement the same interface as old ones with a couple of exceptions (described below).

 

Due to the fact that the concept of layout groups isn’t used in Sitecore V5 anymore (it was replaced with the Device functionality), the appropriate method of the XslHelper class GetLayoutGroup now returns the name of the device.

So, if your current device is set to Print, then the line of XSLT code below will write ‘Print’ string on the page:

 

     <xsl:value-of select=“sc:GetLayoutGroup()” />

 

The same result can be achieved by using the GetDevice() method, which appeared just to replace the previous one in future. Actually, it is strongly recommended to use GetDevice() method since the term Layout group is considered to be obsolete.

 

IMPORTANT NOTE: In order to switch the layouts in Sitecore v4, the query string parameter ‘lg’ was used. Thus, you specified the name of the needed layout as a value of this query string parameter. Now due to the fact that you can choose the name of the query string parameter as well as its value, the device name is returned. It may not be (and it is actually not required to be) the same as the value of qs parameter.

The picture below should avert possible misunderstanding: